package fun.tan90.device.main.config;

import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;
import org.noear.solon.cache.redisson.RedissonCacheService;
import org.noear.solon.cache.redisson.RedissonClientOriginalSupplier;
import org.noear.solon.data.cache.CacheService;
import org.redisson.api.RedissonClient;

@Configuration
public class CacheConfig {

    @Bean
    public RedissonClient redissonClient(@Inject("${redis.ds}") RedissonClientOriginalSupplier supplier) {
        return supplier.get();
    }

    @Bean
    public CacheService cache(@Inject RedissonClient redissonClient) {
        return new RedissonCacheService(redissonClient, 30)
                .enableMd5key(false);
    }

}